package com.rabbit.activity;

import java.util.ArrayList;
import java.util.List;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

import com.rabbit.R;
import com.rabbit.adapter.ShopListAdapter;
import com.rabbit.base.BaseActivity;
import com.rabbit.model.Shop;

/**
 * ShopList
 * @author zhilei.liu
 * 2014-12-12下午5:27:56
 */
public class ShopList extends BaseActivity {

    private View mBack;
    private ListView mLvShopList;
    private ShopListAdapter mAdapter;
    
    @Override
    protected void onCreate(Bundle arg0) {
        super.onCreate(arg0);
        setContentView(R.layout.shop_list);
        initView();
    }

    private void initView() {

        mBack = findViewById(R.id.iv_back);
        mLvShopList = (ListView)findViewById(R.id.lv_shop_list);
        List<Shop> shops = new ArrayList<Shop>();
        Shop shop = new Shop();
        shop.setEvalution(1763);
        shop.setName("兔子涂料专营店");
        shop.setPublicPraise(299);
        shop.setEvalution(21);
        for (int i = 0; i < 12; i++) {
            shops.add(shop);
        }
        mAdapter = new ShopListAdapter(this, shops);
        mLvShopList.setAdapter(mAdapter);
        
        mLvShopList.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) {
                Intent intent = new Intent(ShopList.this,ShopInfo.class);
                startActivity(intent);
            }
        });
        
        mBack.setOnClickListener(new OnClickListener() {
            
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
    
    
}
